 //222.完全二叉树的节点个数
 //https://leetcode.cn/problems/count-complete-tree-nodes/
class Solution {
public:
    int countNodes(TreeNode* root) {
        if(!root) return 0;
        queue<TreeNode*> q;
        q.push(root);
        int ret = 0;
        while(!q.empty())
        {
            ++ret;
            TreeNode* nd = q.front(); q.pop();
            if(nd->left) q.push(nd->left);
            if(nd->right) q.push(nd->right);
        }
        return ret;
    }
};